class Animal:
    def speak(self):
        print("我是动物我会说话")
class People(Animal):
    def speak(self):
        print('say hello')
class Dog(Animal):
    def speak(self):
        print("汪汪汪")
class Pig(Animal):
    def speak(self):
        print("哼哼哼")
# 三个对象都是动物
if __name__ == '__main__':
    obj1 = People()
    obj2 = Dog()
    obj3 = Pig()

class Duck(Animal):
    def speak(self):
        print("哈哈哈")

# 通过一个方法，让他们全都开口说话，统一调用入口
def obj_speak(obj):
    obj.speak()
obj4 = Duck()
obj_speak(obj1)
obj_speak(obj2)
obj_speak(obj3)
obj_speak(obj4)
